#include "Log.h"


CLog * CLog::instance = NULL;

CLog::CLog()
{
	instance = NULL;
	use_stdout = true;
}

CLog * CLog::GetInstance()
{
	if ( instance == NULL )
	{
		instance = new CLog();
	}

	return instance;
}

bool CLog::Init( string log_filename )
{
	if ( log_filename.length() == 0 )
	{
		return false;
		use_stdout = true;	
	}
	else
	{
		log_stream.open( log_filename.c_str(), ios_base::out );
		if ( log_stream.fail() )
		{
			return false;
		}
	}

	return true;
}

bool CLog::Close()
{
	if ( !use_stdout )
	{
		log_stream.close();
	}

	return true;
}

//void CLog::Log( string log )
//{
//	log_stream << log;
//}